home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
BORL_TIP
/
TI100
/
TI191.ASC
< prev
next >
Wrap
Text File
|
1991-09-11
|
3KB
|
133 lines
PRODUCT : TURBO PASCAL NUMBER : 191
VERSION : 3.0xx
OS : PC-DOS, MS-DOS
DATE : March 13, 1986 PAGE : 1/2
TITLE : ADVANCED FILE HANDLING
The following information is presented for advanced users of
Turbo Pascal using MS-DOS or PC-DOS operating systems.
Turbo Pascal uses MS-DOS file handles to open files. Function
call 3DH is used. One of the parameters to this call is the "open
mode," which provides DOS with information about the way you
intend to access the file and what access to allow other
processes (in a networking or future multitasking environment).
Turbo Pascal normally uses an open mode byte of 2, which
designates Compatibility Mode with Read/Write Access and
Inheritance by child processes. By changing the value of this
byte to 0, you may open Read-only files. There may be other
applications for this, especially in a network environment.
Open mode byte for Reset & Rewrite (PC-DOS)
TURBO.COM CSEG:$248D
TURBO-87.COM CSEG:$1F3C
TURBOBCD.COM CSEG:$2393
Open mode byte for Reset & Rewrite (MS-DOS)
TURBO.COM CSEG:$2182
TURBO-87.COM CSEG:$1C31
TURBOBCD.COM CSEG:$2088
The best way to use this information is to create an absolute
variable pointing to the byte, for example:
var OpenModeByte: byte absolute CSeg:$248D; (TURBO.COM PC-DOS)
For additional safety, make sure that the value of the byte being
changed is actually 2 before changing it. Remember, change it
back to 2 if you intend to do normal file opening intermixed with
opening of Read-only or shared files. Information on the
different attributes can be found in the DOS 3.1 Technical
Reference Manual.
{ Using TURBO.COM version 3.00B }
var OpenModeByte: byte absolute CSeg:$248D; (TURBO.COM PC-DOS)
PRODUCT : TURBO PASCAL NUMBER : 191
VERSION : 3.0xx
OS : PC-DOS, MS-DOS
DATE : March 13, 1986 PAGE : 2/2
TITLE : ADVANCED FILE HANDLING
Procedure AccessReadOnly;
begin
if not(OpenModeByte in [0, 2]) then
Error
else
OpenModeByte := 0;
end;
procedure AccessReadWrite;
begin
if not(OpenModeByte in [0, 2]) then
Error
else
OpenModeByte := 2;
end;
The open mode byte for overlay, chain, and execute files is
normally 0, Compatibility Mode with Read Access. The addresses
for these mode bytes can be found by searching the run-time
library for the bytes 00 3D. The first occurrence is the one used
for overlay files, and the second is used for Chain and Execute
files.